#ifndef MODEL__H_HEADER_FILE_3904648___
#define MODEL__H_HEADER_FILE_3904648___

#include <string.h>

typedef enum
{
	MODEL_UNKNOWN = 0, //MODEL_USESTRING
	MODEL_USENUMBERS = 1
} MODEL_ANIMATIONFLAGS;

#define MODEL_STRUSENUMBERS "ANIM__UsEnUmBeRs_"
#define MODEL_STRDEFAULT "NONE__DeFaUlTnAmE_"

class MODEL_ANIMATIONINFO
{
protected:
	friend class MD2Loader;
	int nStart, nEnd, nlStart, nAddFlag;
	char strLastAnim[32];

	float elapsedTime, lastTime;
	int lastFrame;
public:
	MODEL_ANIMATIONINFO()
	{
		nAddFlag = MODEL_UNKNOWN;
		nlStart = -1;
		elapsedTime = lastTime = 0.0f;
		lastFrame = 0;
	}
	void SetAnimName(char *animname)
	{
		strcpy_s(strLastAnim, strCurrentAnim);
		strcpy_s(strCurrentAnim, animname);
		nAddFlag = MODEL_UNKNOWN;
	}
	void SetAnimFrames(const int tstart, const int tend)
	{
		nStart=tstart; nEnd=tend;
		nAddFlag = MODEL_USENUMBERS;
	}
	void Clone(MODEL_ANIMATIONINFO *pOut)
	{
		memcpy(pOut, this, sizeof(MODEL_ANIMATIONINFO));
	}
	char strCurrentAnim[32];
	int nCurrentFrame, nCurrentFirstFrame;
};

struct ModelVertex
{
	float x,y,z;
	float nx,ny,nz;
	float u,v;
};

struct ModelFace
{
	ModelVertex pVerts[3];
};

struct ModelFrame
{
	ModelFrame() { pFaces=NULL; }
	~ModelFrame() { if (pFaces) delete [] pFaces; }
	ModelFace *pFaces;
};

#endif